home *** CD-ROM | disk | FTP | other *** search
/ SGI Enlighten DSM 1.1 / SGI EnlightenDSM 1.1.iso / sco5x / events / policy / archive.sh next >
Linux/UNIX/POSIX Shell Script  |  1998-06-30  |  899b  |  33 lines

  1. #!/bin/sh
  2. #
  3. #  Copyright (c) 1990-1998 Enlighten Software Solutions, Inc.
  4. #
  5. #  Example of automatically archiving files that get too big.
  6. #   1. edit testtab (or select SNMP limits group) and :
  7. #        set:  +jump=1
  8. #        set:  notify=/path/to/example.sh
  9. #
  10. #  DISCLAIMER :
  11. #     THIS PROGRAM IS ONLY AN EXAMPLE. IT IS UNSUPPORTED AND NOT INTENDED
  12. #     FOR ACTUAL USE.  IF YOU DECIDE YOU MAY WANT TO EXECUTE THIS PROGRAM,
  13. #     YOU ARE STRONGLY URGED TO FIRST VERIFY IT'S SUITABLITY AND BEHAVIOR. 
  14. #     
  15. #  USE: This is an example of how you may wish to manage files that grow
  16. #       without bound.
  17. #
  18. # TESTNAME=$1
  19. # VALUE=$2
  20. # UNITS=$3
  21. # ALARM=$4
  22. # TIME=$5
  23.  
  24. MO=`date | cut -d" " -f2`   # form a month-yr file extention
  25. YR=`date | cut -d" " -f7`
  26.  
  27. F=tmp$$
  28. mv $1 $F            # safety first!
  29. cat $F >> $1.$MO$YR             # create/append archive
  30. rm $F                           # rid old file
  31.  
  32. # DONE
  33.